home *** CD-ROM | disk | FTP | other *** search
/ Georgia Wildfire Prevention / Georgia Wildfire Prevention.iso / pc / media / dirs / BackUp / Intro.dir / 00043_Script_buttonbehavior2 < prev    next >
Text File  |  2002-10-15  |  3KB  |  82 lines

  1. --PROPERTIES--
  2. --Hot: The member switched to (hot state).
  3. --FlashSpeed: The speed in which the sprite flashes measured in ticks (1/60th of a sec.)
  4. --Message: The message sent to the stage.
  5. --Glowing: Lets the function know if the sprite is hot or cold.
  6. --RollOvr: The member switched to when rolled-over.
  7. --ButtonSound: The sound that will play when clicked. Channel 2 is reserved for short sounds.
  8. --TimeTracker: Times out the seconds between flashes.
  9. --SpNum: The sprite number of the sprite.
  10. --MyNum: The member's number.
  11. --FlashWait: How long to wait before flashing
  12.  
  13. global zeus
  14. property Hot, FlashSpeed, Message, Glowing, RollOvr, ButtonSound, TimeTracker, SpNum, MyNum, FlashWait, AssocImage
  15.  
  16. --Captures the spritenumber.
  17. on new me
  18.   SpNum = me.spritenum
  19.   MyNum=sprite(SpNum).member.number
  20. end
  21.  
  22. --Creates the dialog box for the behavior.
  23. on getpropertydescriptionlist me
  24.   set pList = [#Hot:[#comment: "What is the cast member name for the Hot state?", #format: #string, #default: ""], \
  25.  #RollOvr: [#comment: "Which member would you like to use for the rollover?", #format: #string, #default: ""], \
  26.  #AssocImage: [#Comment: "Which image is this member associated with?", #format: #string, #default: ""],\
  27.  #ButtonSound:[#comment: "What sound would you like to play when the button is pressed?",#format:#string,#default:"Click"],\
  28.  #Message:[#comment:"What movie would you like to open?",#format:#string,#default: "Next"],\
  29.  #FlashSpeed:[#comment:  "How often would you like the member to flash (ticks)?", #format: #integer, #range: [#min: 0, #max: 60], #default: 0], \
  30.  #FlashWait: [#comment: "How Long would you like to wait before Flashing (ticks)?", #format:#integer, #default: "0"]]
  31.   return plist
  32. end
  33.  
  34. --This is for the rollover.
  35. on mouseenter me
  36.   sprite(SpNum).membernum = member(RollOvr).number
  37.   if AssocImage <> "" then
  38.     set TheMouseEnter = 1
  39.     sendallsprites(#imagechange, AssocImage, TheMouseEnter)
  40.     end if
  41.     sprite(SpNum).cursor = 280  
  42.     updateStage  
  43. end
  44. on mouseleave me
  45.   sprite(SpNum).membernum = member(MyNum).number
  46.   set TheMouseEnter = 0
  47. --  sendallsprites(#imagechange, "Start", TheMouseEnter)
  48.   sprite(SpNum).cursor = 293 
  49.   --Glowing = 0
  50.   updateStage
  51. end
  52.  
  53. --This goes to another frame and tells the movie what to do. Also plays the sound, if any.
  54. on mousedown me
  55.   if  ButtonSound <> "" then
  56.     sound(2).play(member(ButtonSound)) 
  57.   end if
  58.   WhichMovie (zeus, message)
  59. end
  60.  
  61. --This toggles the flashing object back  and forth at the desired speed while the mouse is not over it.
  62. --on prepareframe me
  63. --  if FlashSpeed <> 0 then
  64. --    if the timer > FlashWait then
  65. --      if sprite(SpNum).cursor <> 280 then
  66. --        set TimeTracker = the ticks
  67. --        repeat while the ticks < TimeTracker + FlashSpeed
  68. --          nothing
  69. --        end repeat
  70. --        if Glowing = 0 then
  71. --          sprite(SpNum).membernum = member(Hot).number
  72. --          Glowing = Glowing + 1
  73. --        else
  74. --          sprite(SpNum).membernum = member(MyNum).number
  75. --          Glowing = GLowing - 1
  76. --        end if
  77. --        updateStage
  78. --      end if
  79. --    end if
  80. --  end if
  81. --end
  82.